package common;

import java.util.ArrayList;
import ConnDatabase.ConnDatabase;
import java.sql.*;

public class HirableRoomList {
	
	public HirableRoomList() {
	
	}

	public SelectedPart getRooms(int pageIndex,int pageSize,
					String section,String building) {
		
		String sectionStr = "";
		String buildStr = "";
		if (!section.equalsIgnoreCase(""))
			sectionStr = " and r.seccode='" + section + "'";
		if (!building.equals(""))
			buildStr = " and r.building='" + building + "'";	
			
		String countStr = "select count(*) from room r,section s";
		countStr += " where r.seccode = s.serialno";
		countStr += sectionStr + buildStr;
		String roomsStr = "select r.code id,s.name section,r.building,r.room_code room,";
		roomsStr += "r.area,r.room_type roomtype from room r, section s";
		roomsStr += " where r.seccode = s.serialno";
		roomsStr += sectionStr + buildStr;
		
		SelectedPart sp = null;
		RoomList rl = new RoomList();
		try {
			//sp = rl.getRooms(pageIndex,pageSize,countStr,roomsStr);	
		} catch (RoomException e) {
			System.out.println("hireroomlist : " + e.getMessage());
		}
				
		return sp;
			
	}	
	
}